<?php
class Master_th_ajaran extends CI_Model 
{

	function __construct()
	{
		parent::__construct();
	}
	
	function read()
	{	
		$this->db->select('*');
		$this->db->from('m_th_ajaran');
		$this->db->order_by('id_m_th_ajaran','desc');

		$query = $this->db->get();		
		return $query->result();
	}

	function save($dataInsert)
	{
		$query = $this->db->insert('m_th_ajaran', $dataInsert);
		return $query;
	}
	
	function edit($id_m_th_ajaran)
	{
		$this->db->where('id_m_th_ajaran',$id_m_th_ajaran);
		$query=$this->db->get('m_th_ajaran');
		return $query->result();
	}
	
	function update($id_m_th_ajaran,$dataUpdate)
	{
		$this->db->where('id_m_th_ajaran', $id_m_th_ajaran);
		$update = $this->db->update('m_th_ajaran', $dataUpdate);
		return $update;
	}
	
	function delete($id_m_th_ajaran)
	{
		$this->db->where('id_m_th_ajaran', $id_m_th_ajaran);
		$delete = $this->db->delete('m_th_ajaran');
		return $delete;
	}
	
	function detail($id_m_th_ajaran)
	{
		$this->db->select('*');
		$this->db->from('m_th_ajaran');
		$this->db->where('id_m_th_ajaran', $id_m_th_ajaran);

		$query = $this->db->get();		
		return $query->result();
	}

}